/*
 * @Author: your name
 * @Date: 2021-11-18 10:00:39
 * @LastEditTime: 2021-11-30 19:15:55
 * @LastEditors: Please set LastEditors
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath: \li-yuwei\serve\app\utils\timeFormart.js
 */
//时间戳转换为时间
function timestampToTime(timestamp) {
    let Y, M, D, h, m, s;
    var date = new Date(timestamp); //时间戳为10位需*1000，时间戳为13位的话不需乘1000
    Y = date.getFullYear() + "-";
    M =
        (date.getMonth() + 1 < 10 ?
            "0" + (date.getMonth() + 1) :
            date.getMonth() + 1) + "-";
    D = date.getDate() + " ";
    h = date.getHours() + ":";
    m = date.getMinutes() + ":";
    s = date.getSeconds();
    return Y + M + D + h + m + s;
}
module.exports = timestampToTime;